{{- if (.Values.global.enabledModules | has "operator-prometheus-crd") }}
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: cilium-operator
  namespace: d8-monitoring
  {{- include "helm_lib_module_labels" (list . (dict "app" "operator" "prometheus" "main")) | nindent 2 }}
spec:
  jobLabel: app
  podMetricsEndpoints:
  - port: https-metrics
    scheme: https
    tlsConfig:
      insecureSkipVerify: true
    bearerTokenSecret:
      name: "prometheus-token"
      key: "token"
    honorLabels: true
    relabelings:
    - targetLabel: tier
      replacement: cluster
    - targetLabel: job
      replacement: "cilium-operator"
  selector:
    matchLabels:
      app: operator
  namespaceSelector:
    matchNames:
    - d8-{{ .Chart.Name }}
{{- end }}
